package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;
import java.util.UUID;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016102100732604";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDKz9GtZpB8t/ibfo7785/5/LL3qis4Gp8/DBsRyS9FzFgPCGSppi2wnUhNAU7twNpAyZNfhsngDpZN6ZZ5bU77aLVv6+/qwAqnIRIv4BYEIGQO18BVCI7/JA3WDVhS0VXX9UxBV7yLREOQDD+iu3KUMUJyXXIZ72VfGvt8tq0oKMm2g0Anro9M/ozodKCzXlc/COUIbWYzZHdiyPXbpBjRdvYJYrwpRoMutDrQupeLrdNjf33aaPFpyCJ5+LOox9IvZnVeYKk0OZeleCvvqy31kZfBENteoVAsOI9NViwEzkfllB5jVraayx5dDjOuj5yCcCk/0u0wLkOTfBN+Lq7bAgMBAAECggEASJfuc2S83wdywyWfxGtFndNns+KDKcfNrGGG5uzeMNudwXO9pEPJIuiJUpbfS5a2CG6eg5jZdYuDHUw5AimwFak7GF6ZN6uZpIzf16cb+kolxnJPc6Bmnsim8zE/phUr5ur0aocfA7JhhJP9yx/ROV4QbKMqDkJ0RICB9/fjLvYXYSCVWUpbCs3shj2xuGTcMwymqYW0vm7TY17XCle0jNHoFqqgTI2xPEzWmp9VMUzbu2gewAcYPb62rfQGVlnFka3QsAk1C2UrvoJrPABzbQYBowH2QG1Jb7jSLpZAkeAQ3La1bB1zHqVsy++/S3t9bwwwjvxfYGNJYe/aj9f/MQKBgQDpvLnB6ONt2JXgOhGhzClPaXcPdAaIUPBG/zgG3j//D2V/Mcls6kmL+LpOKVP3WQzBYxDWNVKLiMX+rQzAzD4M3fG79/9npda/Dnz1pE2RDA99ZDJblgkKaOTjoLc+RCVdaUo+X3GKYQwluO0DnfLlbG2aFa7pjykVnVi29fz0VQKBgQDeIQf0ZGGpo0f23eZpdTljrhk5wqAzjRMFQhULFs952nFyNXGkBzNLIgEjmLDQsFNx5z8SatAofo/EBQd9f2eGuf0RmfTa7DFlrZds4JLEHijIZOfTuRpsg/DMfFCJvkuwIqy5gTZD/kkM1l4ikBc3RACDCci2B0TZZKyvzWvGbwKBgQDpRvIeFdDmUMNEhrASSzDvkNLDGYlrg1xLf2zrbeVxKmyiBY6CpVHB4PwQBi9HLhkM6VJkd9Nqb5csFooj4bQMI3afo2PEjj9Fb7BHeTPxD5hmDRo1Tgi32viWNlCsVFb2Y581oQwwj6sP+wCSG5HQZ+b7YaiwcbEPYXqpH9jWAQKBgAeBCinBcmMutvGqEWyinyu05/lBj/Pt4iSdVOSpAp1VOdvn3kzySVNSdMNlFyQVsNv6OfE/VoTnsaenm9crhK3SfrAniVQUAp8yvBjbhVnGww3yCrrmV/QuiOX/lSDyItBye29Q5Cpr3r/mRgvY3k/ppjLHE9bCbBsEAal2wRtVAoGAct2wgx//43goOPw5HoVHJkbDZjQGCIRMBhGfv62QfypnKC0o7xxASE8jxrUdtJs+vHO/tEWVGpwu+cUdeX8HvqsJHJ6Uz8CssqJCALNat/5jfGC/LgYHJbA1eL4d5MIm+I4iuy8BTiRqEC7aHo7+J2F44DlfN980g71igjamJL8=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApH3At1H0OzFf/WCJb7PQUuT/PPIpLWC8ZT+KgT0i06JBlef6giBO1A1yIZJdeuPsvDT/Ekb7Qf++L2+3+8r7xtvlKN8h/lYeK7dcxRt8QzqD1qVWPhr7N7ckczc3Tj2fmedWTrpYlCqTQ9/HlaotR4X5ngrj4KlQ1P8vbh/wjNw1I7REAi/jPL0qxQsIYUCjZaLpUM4Kx0kE2EXfDLUWPQe6VWf7a3svh1cX1LJyz9aKJ2tpI+RBHceLZj4v/wN60kOJ58aPrd1jAjQ8wRU66JmSr2p3bBaT83rDgkqMgYPkUQcLtSaVTIHZCrbWfm350OMYG55evwrwgUhr5hToMQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=124这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8989/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    //public static String return_url = "http://localhost:8989/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";
    public static String return_url = "http://localhost:8080/dangdang/front/pay/return_url.jsp";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关          沙箱环境下需要替换为：                "https://openapi.alipaydev.com/gateway.do"
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    public static void main(String[] args) {
        System.out.println(UUID.randomUUID().toString());
    }
}


